import { BaseEntity } from "src/baseEntity";
import { Project } from "src/project/project.entity";
import { System } from "src/system/system.entity";
import { UserSys } from "src/user/userSys.entity";
import { Column, Entity, JoinTable, ManyToMany, ManyToOne } from "typeorm";



@Entity("deduction")
export class Deduction extends BaseEntity {
    @ManyToOne(() => System)
    system: System

    @ManyToMany(() => UserSys)
    @JoinTable()
    user: UserSys[]

    @ManyToOne(() => UserSys)
    target: UserSys

    @ManyToOne(() => Project, { orphanedRowAction: "delete" })
    project: Project

    @Column()
    score: number

    @Column()
    reason: string

    @Column({
        nullable: true
    })
    comment: string
}